# coding=utf-8
from django.db import models

# Create your models here.


class UICaseModel(models.Model):
    name = models.CharField(max_length=50, null=False)
    desc = models.CharField(max_length=200, null=True)

    class meta:
        db_table = 'uicasemodel'


class UICasePages(models.Model):
    name = models.CharField(max_length=50, null=False)
    model = models.ForeignKey(to='elements.UICaseModel', on_delete=models.PROTECT)
    class meta:
        db_table = 'uicasepages'


class UIElementes(models.Model):
    name = models.CharField(max_length=50, null=False)
    by = models.CharField(max_length=10, help_text='定位方式')
    value = models.CharField(max_length=100, help_text='定位元素值')
    page = models.ForeignKey(to='elements.UICasePages', on_delete=models.PROTECT)
    class meta:
        db_table = 'uielements'


class UIAction(models.Model):
    name = models.CharField(max_length=20, null=False, help_text='元素操作')
    module_list = (
        ('webdriver', 'webdriver'),
        ('action_chains', 'action_chains'),
    )
    module = models.CharField(max_length=20, choices=module_list)
    value = models.CharField(max_length=20)

    class meta:
        db_table = 'uiaction'
